import React, {Component} from 'react';
import {Image,TouchableOpacity,StyleSheet} from 'react-native';
import {scaleSize} from '../../../utils/screen';
import FontText from '../FontText';
export default class Column extends Component {
    render() {
        let {fontstyle = {},mkey,text,columnStyle = {},renderStyle} = this.props;
        if(typeof renderStyle == 'function' && mkey){
            let m = renderStyle(mkey)||{};
            fontstyle = Object.assign({},fontstyle,m.fontstyle);
            columnStyle = Object.assign({},columnStyle,m.style);
        }
        return (
            <TouchableOpacity 
                activeOpacity = {0.8}
                onPress = {()=>this.onPress()}
                style = {[styles.box,columnStyle]}>
                <FontText font = {'book'} style = {[styles.fontStyle,fontstyle]}>{text}</FontText>
            </TouchableOpacity>
        );
    }
    onPress(){
        let {onPress} = this.props;
        onPress && onPress();
    }
}

const styles = StyleSheet.create({
    box:{
        flexDirection: 'row',
        alignItems: 'center',
        flex:1
    },
    fontStyle:{
        fontSize: scaleSize(30),
        color:"#fff"
    }
})